package superviseur.ihm.gardien;

import javax.swing.JToggleButton;
import java.awt.Color;
import java.awt.event.*;
import javax.swing.event.*;

public class BackLightButton extends JToggleButton
{

    public BackLightButton()
    {
	try {
	    jbInit();
	}
	catch(Exception e) {
	    e.printStackTrace();
	}
    }
    private void jbInit() throws Exception {
	this.setBackground(new Color(0, 130, 0));
	this.addChangeListener(new javax.swing.event.ChangeListener() {
	    public void stateChanged(ChangeEvent e) {
		this_stateChanged(e);
	    }
	});
    }


    void this_stateChanged(ChangeEvent e)
    {
	boolean selected = isSelected();
	if (selected) setBackground(Color.green);
	else setBackground(Color.green.darker().darker());
    }
}